package com.example.demo1.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.demo1.fragment.BaseFragment
import com.example.demo1.reposity.Content
/**
 * 文常知识界面viewpager适配器
 * **/
class MyViewPagerAdapter(var fragmentActivity: FragmentActivity
,var list:List<Content>) : FragmentStateAdapter(fragmentActivity){
    override fun getItemCount(): Int {
        return list.size
    }



    override fun createFragment(position: Int): Fragment {
        val fragment=BaseFragment.newInstance(list.get(position))
        return fragment
    }
}